package com.echo.auth;

import com.echo.auth.business.model.SysUser;
import com.echo.auth.business.service.SysUserService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;

import javax.annotation.Resource;

/**
 * @version: V1.0
 * @author: chentailai
 * @description: OAUTH2 认证服务端
 * @className: EchoAuthSystemApplication
 * @packageName: com.echo.auth
 * @data: 2020/3/26 16:56
 **/
@EnableDiscoveryClient
@EnableFeignClients
@SpringBootApplication
public class EchoAuthServerApplication implements CommandLineRunner {

    @Resource
    private SysUserService userService;

    public static void main(String[] args) {
        SpringApplication.run(EchoAuthServerApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        SysUser user = userService.getUserByName("chen");
        if(user != null){
            System.out.println("================准备用这个用户登录: "+user.getUsername());
        }
    }
}
